"use strict";
const nodemailer = require("nodemailer");
const account = require("./mail.json");
const options = require("./mail.options.js").options;

async function main(mailOptions) {
    // let account = await nodemailer.createTestAccount();

    let transporter = nodemailer.createTransport({
        host: account.host,
        port: account.port,
        secure: false,
        auth: {
            user: account.user,
            pass: account.pass
        }
    });

    let info = await transporter.sendMail(mailOptions)
    if (info.messageId) {
        console.log('----- 邮件发送成功✔ -----');
    }
}

// exports.send = function (_options) {
//     main(_options).catch(console.error);
// }

main(options).catch(console.error);